<template> <Switch v-bind="attrs" v-model:checked="_value" /></template>
<script lang="ts" setup>
  import { ref, useAttrs, watch } from 'vue';
  import { Switch } from 'ant-design-vue';
  const attrs = useAttrs() as any;

  const props = defineProps({
    modelValue: {
      type: Boolean as PropType<boolean>,
      default: false,
    },
  });
  const emit = defineEmits(['update:modelValue']);
  const _value = ref(false);
  watch(
    () => props.modelValue,
    (newVal) => {
      _value.value = newVal;
    },
    {
      immediate: true,
    },
  );
  watch(
    () => _value.value,
    () => {
      emit('update:modelValue', _value.value);
    },
  );
</script>
